package com.mvc.finance.model;

import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.mvc.ProjectUtils;
import com.mvc.base.model.BaseCompany;

@Entity(name = "B_EXPENSE_APPLY")
public class ExpenseApply extends BaseCompany {
	public static final int	STATUS_APPLYING	 = 1;
	public static final int	STATUS_COMMIT	 = 5;
	public static final int	STATUS_BACKWARD	     = 7;
	public static final int	STATUS_APPROVAED	= 10;
	public static final int	STATUS_PAYED	 = 20;

	@NotNull
	private Integer	        applyUserId;
	@NotNull
	private Double	        total;
	@NotNull
	private Date	        predictPayDate;
	private Date	        payDate;
	private Boolean	        backup;
	private Date	        backupDate;
	@Length(max = 128)
	private String	        remark;
	@NotNull
	private Integer	        status;
	@NotNull
	private Date	        generateDate;

	private Integer	        approvalUserId;

	@Length(max = 64)
	private String	        backwardReason;

	@Transient
	List<ExpenseApplyItem>	expenseApplyItems;

	public Integer getApplyUserId() {
		return applyUserId;
	}

	public void setApplyUserId(Integer applyUserId) {
		this.applyUserId = applyUserId;
	}

	public Double getTotal() {
		return total;
	}

	public void setTotal(Double total) {
		this.total = total;
	}

	public Date getPredictPayDate() {
		return predictPayDate;
	}

	public void setPredictPayDate(Date predictPayDate) {
		this.predictPayDate = predictPayDate;
	}

	public Date getPayDate() {
		return payDate;
	}

	public void setPayDate(Date payDate) {
		this.payDate = payDate;
	}

	public Boolean getBackup() {
		return backup;
	}

	public void setBackup(Boolean backup) {
		this.backup = backup;
	}

	public Date getBackupDate() {
		return backupDate;
	}

	public void setBackupDate(Date backupDate) {
		this.backupDate = backupDate;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Date getGenerateDate() {
		return generateDate;
	}

	public void setGenerateDate(Date generateDate) {
		this.generateDate = generateDate;
	}

	public List<ExpenseApplyItem> getExpenseApplyItems() {
		return expenseApplyItems;
	}

	public void setExpenseApplyItems(List<ExpenseApplyItem> expenseApplyItems) {
		this.expenseApplyItems = expenseApplyItems;
	}

	public Integer getApprovalUserId() {
		return approvalUserId;
	}

	public void setApprovalUserId(Integer approvalUserId) {
		this.approvalUserId = approvalUserId;
	}

	public String getNo() {
		return ProjectUtils.getExpenseApplyNo(getObjectId());
	}

	public String getBackwardReason() {
		return backwardReason;
	}

	public void setBackwardReason(String backwardReason) {
		this.backwardReason = backwardReason;
	}

}
